<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01//EN"
          "http://www.w3.org/TR/html4/strict.dtd">
<!-- Material used from: HTML 4.01 specs: http://www.w3.org/TR/html401/ -->
<html>
<head>
  <META http-equiv="Content-Type" content="text/html; charset=ISO-8859-1">
  <title>Polly - Load Polly into dragonegg</title>
  <link type="text/css" rel="stylesheet" href="menu.css">
  <link type="text/css" rel="stylesheet" href="content.css">
</head>
<body>
<!--#include virtual="menu.html.incl"-->
<div id="content">
<!--=====================================================================-->
<h1>Load Polly into dragonegg and automatically run it at -O3</h1>
<!--=====================================================================-->

<p><b>Note:</b>This is a quick note on how to load Polly into
  dragonegg. The choice of front-end does not affect the passes
  available with Polly, only the syntax is different.
  The <a href="example_load_Polly_into_clang.html">examples for use
  with clang</a> can also be performed with Polly, with suitable
  corrections in the syntax.

<h2>Compile dragonegg with support for LLVM plugins</h2>

The support for LLVM plugins in dragonegg is still experimental, and
hence protected by a build option. You must rebuild dragonegg with the
following options:

<pre class="code">
$ GCC=${PATH_TO_GCC} LLVM_CONFIG=${PATH_TO_LLVM_CONFIG} ENABLE_LLVM_PLUGINS=1 make
</pre>

<h2>Load Polly into dragonegg</h2>

By loading Polly into dragonegg, the Polly options become automatically
available. You can load Polly either by adding the relevant commands to
the CPPFLAGS or by creating an alias.

<pre class="code">
$ export CPPFLAGS="-fplugin=/path/to/dragonegg.so -fplugin-arg-dragonegg-llvm-option=load:${POLLY_BUILD_DIR}/lib/LLVMPolly.so"
</pre>

or

<pre class="code">
$ alias pollycc gcc -fplugin=/path/to/dragonegg.so -fplugin-arg-dragonegg-llvm-option=load:${POLLY_BUILD_DIR}/lib/LLVMPolly.so
</pre>

<h2>Optimizing with Polly</h2>

Optimizing with Polly is as easy as adding <b>-O3 -fplugin-arg-dragonegg-llvm-option=-polly</b> to your
compiler flags (Polly is only available at -O3).

<pre class="code">pollycc -O3 -fplugin-arg-dragonegg-llvm-option=-polly file.c</pre>

<h2>Passing various options to Polly</h2>

As must be evident from the examples so far, options to LLVM and its
plugins are passed via the <b>-fplugin-arg-dragonegg-llvm-option</b>
commandline argment.
The <a href="example_load_Polly_into_clang.html">examples for use with
clang</a> can be executed with dragonegg by replacing
the <b>-mllvm</b> syntax with the dragonegg syntax.

</div>
</body>
</html>
